<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <style type="text/css">
        .outer{
            width:200px;
            height:100px;
            border:1px solid black;
            margin:20px;
        }
        .inner-100percent{
            width: 100%;
            height:100px;
            background: darkcyan;
        }
        .inner-auto{
            width:auto;
            padding:0px 10px;
            height:100px;
            background:salmon;
        }
    </style>
</head>
<body>
<div class="outer">
    <div class="inner-100percent"></div>
</div>
<div class="outer">
    <div class="inner-auto"></div>
</div>
</body>
</html>